package com.exsun.ex1077.network

import com.alibaba.fastjson.JSONObject
import com.exsun.ex1077.model.Device
import com.exsun.ex1077.model.LabelValue
import com.exsun.ex1077.network.entity.*
import com.exsun.ex1077.network.response.ApiResponse
import com.exsun.ex1077.network.response.NoMsgApiResponse
import com.zhangping.fastjetpack.model.KeyValue
import com.zhangping.fastjetpack.model.Tree
import okhttp3.MultipartBody
import retrofit2.http.*

/**
 * 描述：API接口
 * 作者：ZhangPing
 * 创建时间：2022/2/23 21:34
 */
interface ApiService {

    @POST(ApiUrl.LOGIN)
    suspend fun login(@Query("username") text: String, @Query("password") password: String): NoMsgApiResponse<Login>
    @POST(ApiUrl.CHECK_ACCOUNT_MOBILE)
    suspend fun checkAccountMobile(@Query("mobile") mobile: String, @Query("username") username: String): ApiResponse<Any?>
    @POST(ApiUrl.SEND_SMS)
    suspend fun sendSms(@Query("mobile") mobile: String): ApiResponse<Any?>
    @POST(ApiUrl.REGISTER)
    suspend fun register(@Body body: JSONObject): ApiResponse<Login?>
    @POST(ApiUrl.MODIFY_PASSWORD)
    suspend fun modifyPassword(@QueryMap queryMap: JSONObject): ApiResponse<Any?>
    @POST(ApiUrl.HEAD_UPLOAD)
    @Multipart
    suspend fun headUpload(@Part part: MultipartBody.Part): ApiResponse<String?>
    @POST(ApiUrl.MAP_VEHICLE_LIST)
    suspend fun mapVehicleList(): ApiResponse<MapDataModel?>
    @POST(ApiUrl.MAP_VEHICLE_GSP)
    suspend fun mapVehicleGps(@Query("dvo") deviceNo: String): ApiResponse<MapVehicleGps?>
    @POST(ApiUrl.MAP_SEARCH)
    suspend fun mapSearch(@Query("plateNumber") plateNumber: String): ApiResponse<List<MapSearch>?>
    @POST(ApiUrl.MSG_LIST)
    suspend fun msgList(@Body body: JSONObject): ApiResponse<Page<Msg>?>
    @POST(ApiUrl.MSG_DETAIL)
    suspend fun msgDetail(@Query("id") id: String): ApiResponse<MsgSend?>
    @POST(ApiUrl.MSG_UNREAD_COUNT)
    suspend fun msgUnReadCount(): ApiResponse<UnReadMsgCount?>
    @POST(ApiUrl.MSG_REMOVE)
    suspend fun msgRemove(@Query("id") id: String): ApiResponse<Any?>
    @POST(ApiUrl.MSG_BATCH_REMOVE)
    suspend fun msgBatchRemove(@Query("ids") ids: String): ApiResponse<Any?>
    @POST(ApiUrl.VEHICLE_DEPT_TREE)
    suspend fun vehicleDeptTree(): ApiResponse<List<Tree>>
    @POST(ApiUrl.VEHICLE_LIST)
    suspend fun vehicleList(@Body bodyMap: JSONObject): ApiResponse<DeviceList>
    @POST(ApiUrl.VEHICLE_MILEAGE)
    suspend fun vehicleMileage(@QueryMap queryMap: JSONObject): ApiResponse<List<Mileage>?>
    @POST(ApiUrl.VEHICLE_TRACK_LIST)
    suspend fun vehicleTrackList(@QueryMap queryMap: JSONObject): ApiResponse<List<VehicleTrack>?>
    @POST(ApiUrl.VEHICLE_TRACK_DETAIL)
    suspend fun vehicleTrackDetail(@QueryMap queryMap: JSONObject): ApiResponse<List<TrackDetail>?>
    @POST(ApiUrl.VEHICLE_VIDEO)
    suspend fun vehicleVideo(@QueryMap queryMap: JSONObject): ApiResponse<List<VehicleVideo>?>
    @POST(ApiUrl.PHOTO_UPLOAD)
    @Multipart
    suspend fun photoUpload(@Part part: List<MultipartBody.Part>): ApiResponse<List<String>?>
    @POST(ApiUrl.FEEDBACK_SUBMIT)
    suspend fun feedbackSubmit(@Body body: JSONObject): ApiResponse<Any?>
    @POST(ApiUrl.CHECK_UPDATE)
    suspend fun checkUpdate(): ApiResponse<String?>
    @POST(ApiUrl.SERVICE_TEL)
    suspend fun serviceTel(): ApiResponse<ServiceTel?>
    @POST(ApiUrl.MAP_DEVICE_MILEAGE_RANK)
    suspend fun mapDeviceMileageRank(): ApiResponse<List<MileageRank>>
    @GET(ApiUrl.MANAGE_TYPE_LIST)
    suspend fun manageTypeList(): ApiResponse<List<KeyValue>>
    @POST(ApiUrl.MILEAGE_COUNT_LIST)
    suspend fun mileageCountList(@Body body: JSONObject): ApiResponse<Page<MileageRank>>
    @POST(ApiUrl.BOUNDS_LIST)
    suspend fun boundsList(@Body body: JSONObject): ApiResponse<Page<Bounds>>
    @GET(ApiUrl.BOUNDS_DELETE)
    suspend fun boundsDelete(@Query("id") id: String): ApiResponse<Any?>
    @POST(ApiUrl.BOUNDS_RENAME)
    suspend fun boundsRename(@Body body: JSONObject): ApiResponse<Any?>
    @POST(ApiUrl.BOUNDS_SAVE)
    suspend fun boundsSave(@Body body: JSONObject): ApiResponse<Any?>
    @POST(ApiUrl.BOUNDS_UPDATE)
    suspend fun boundsUpdate(@Body body: JSONObject): ApiResponse<Any?>
    @GET(ApiUrl.BOUNDS_QUERY)
    suspend fun boundsQuery(@Query("id") id: String): ApiResponse<Bounds?>
    @GET(ApiUrl.CHECK_OBJECT)
    suspend fun checkObject(): ApiResponse<List<Int>>
    @POST(ApiUrl.MAP_BOUNDS_LIST)
    suspend fun mapBoundsList(@Body body: JSONObject): ApiResponse<List<Bounds>>
    @POST(ApiUrl.DEVICE_NO_CHECK)
    suspend fun deviceNoCheck(@Query("deviceId") deviceNo: String): NoMsgApiResponse<Device?>
    @GET(ApiUrl.DEVICE_MODEL_LIST)
    suspend fun deviceModelList(): ApiResponse<List<LabelValue>>
    @POST(ApiUrl.DEVICE_SIM_CHECK)
    suspend fun deviceSimCheck(@Query("id") id: String, @Query("iccid") iccid: String): NoMsgApiResponse<Any?>
    @POST(ApiUrl.DEVICE_VEHICLE_OBJECT_NAME_SEARCH)
    suspend fun deviceObjectNameSearch(@Query("numberPlate") numberPlate: String, @Query("objType") objType: Int, @Query("companyId") companyId: String): ApiResponse<List<Device>>
    @POST(ApiUrl.DEVICE_PERSON_SEARCH)
    suspend fun devicePersonSearch(@Query("name") name: String, @Query("companyId") companyId: String): ApiResponse<List<Device>>
    @POST(ApiUrl.DEVICE_SAVE)
    suspend fun deviceSave(@Body body: JSONObject): ApiResponse<Any?>
    @POST(ApiUrl.DEVICE_UPDATE)
    suspend fun deviceUpdate(@Body body: JSONObject): ApiResponse<Any?>
    @POST(ApiUrl.DEVICE_OBJECT_PHOTO_UPLOAD)
    @Multipart
    suspend fun deviceObjectPhotoUpload(@Part part: List<MultipartBody.Part>): ApiResponse<List<String>>
    @POST(ApiUrl.DEVICE_PERSON_PHOTO_UPLOAD)
    @Multipart
    suspend fun devicePersonPhotoUpload(@Part part: List<MultipartBody.Part>): ApiResponse<List<String>>
    @POST(ApiUrl.DEVICE_OBJECT_NAME_CHECK)
    suspend fun deviceObjectNameCheck(@Query("numberPlate") numberPlate: String, @Query("objType") objType: Int, @Query("companyId") companyId: String): ApiResponse<Any?>
    @POST(ApiUrl.DEVICE_DELETE)
    suspend fun deviceDelete(@Query("equipmentId") equipmentId: String): ApiResponse<Any?>
    @POST(ApiUrl.DEVICE_QUERY)
    suspend fun deviceQuery(@Query("equipmentId") equipmentId: String): ApiResponse<Device?>
    @GET(ApiUrl.MENU_PERMISSION)
    suspend fun menuPermission(): ApiResponse<List<MenuTree>>
    @GET(ApiUrl.VIDEO_CLOSE_TIME)
    suspend fun videoCloseTime(): ApiResponse<Long>
}